<template>
	<view>
		<stop isBack>
			<view slot="content">报工入口</view>
		</stop>
		<view class="bc13">
			<!-- #ifdef H5 -->
			<view class="flcc pad3 bcf">
				<view class="flex1 fwb fs12 c11 list-style-1">Web调试入口</view>
				<view class="flex1  pad3 w100">
					<input class="fs14 tac" v-if="showInput" v-model="scan" placeholder="请扫码" @focus="onfocus" focus
						@blur="onblur" selection-start="0" selection-end="100" @input="oninput" @confirm="done"
						:hold-keyboard="true"></input>
					<input :value="scan" v-else />
				</view>
				<view class="pad3 w100 bdtso flrc pos-r">
					<view class="fa fa-qrcode fa-2x pos-r"></view>
					<ripple></ripple>
				</view>
			</view>
			<!-- #endif -->
			<view class="pad3 bcf flrc pos-r" @tap="setMemOpen">
				<view class="flex1 fwb fs12 c11 list-style-1">功能选择</view>
				<view class="fs8 c12 padr1">记住上次的选择:</view>
				<view>
					<switch color="#39B54A" :class="isMemOpen?'checked':''" :checked="isMemOpen?true:false"></switch>
				</view>
				<!-- <view class="c03 fs14"><text class="fa fa-cog marl2"></text></view> -->

				<ripple></ripple>
			</view>
			<view class="flex-r flex-wrap flex-start mart2 padl2">
				<view class="w20 bcf c13 flcc pad1 pos-r round5 bdrso mar2" @tap="setFunc('bg_pt'+i)" v-for="i in 8">
					<view class="wh13-13 round50 fs14 shadow flcc pos-r" :class="`color${(i+1)%10+1}`">
						<text class="fa fa-cubes"></text>
					</view>
					<view class="mart1 c11">普通报工</view>
					<ripple-black></ripple-black>
					<view class="t-5 r-5 pos-a c01 fs12" v-if="curFuncName === 'bg_pt'+i">
						<view class="fa fa-check-circle"></view>
					</view>
				</view>
			</view>

			<view v-if="1 === 0" class="pad2 tac">
				<view class="pad7 bdda bc13 pos-r">
					未选择任何功能
					<ripple></ripple>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import log from '../../../assets/js/log';
	import scan from '../../../mixin/scan';

	export default {
		mixins:[scan],
		data() {
			return {
				scan: "SYD2025036-01.0.20250410223440",
				showInput: true,
				isMemOpen: false,
				curFuncName: "bg_pt"
			}
		},
		onLoad() {
		},
		mounted() {
			let isMemOpen = this.$com.getLocData("mes.work.isMemOpen")
			this.isMemOpen = isMemOpen === "true"
			if (this.isMemOpen) {
				this.curFuncName = this.$com.getLocData("mes.work.funcName")
			}
		},
		onShow() {
			this.ezScanCbFunc = (code)=>{
				console.log("入口扫码",code);
				this.goto("/pages/mes/baogong/baogong?code=" + code)
			}
			setTimeout(() => {
				this.showInput = false
			}, 300)
			setTimeout(() => {
				this.showInput = true
			}, 600)
		},
		methods: {
			setFunc(name) {
				this.curFuncName = name
				this.$com.setLocData("mes.work.funcName", name)
			},

			setMemOpen() {
				this.isMemOpen = !this.isMemOpen
				this.$com.setLocData("mes.work.isMemOpen", this.isMemOpen)
			},
			done(e) {
				setTimeout(() => {
					this.goto("/pages/mes/baogong/baogong?code=" + this.scan)
				}, 200)

			},
			oninput(e) {
				// console.log(e.detail.value);
			},
			onfocus() {},
			onblur(e) {
				// this.showInput = false
				setTimeout(() => {
					this.showInput = false
				}, 300)
				setTimeout(() => {
					this.showInput = true
				}, 600)
			}
		}
	}
</script>

<style>

</style>